package main

import (
	"context"
	"encoding/json"
	"fmt"
	"gitee.com/leo-xin/novel_distribution_sdk_go/heiyan"
	"gitee.com/leo-xin/novel_distribution_sdk_go/heiyan/config"
	"io"
)

func orderExample() {

	ctx := context.Background()

	configuration := config.NewConfiguration()
	configuration.LogEnable = true
	apiClient := heiyan.Init(configuration)

	resp, httpRes, err := apiClient.OrderApi().
		Get(ctx).
		Pid(PId).Secret(Secret).
		StartDate("2024-09-12 00:00:00").EndDate("2024-09-13 00:00:00").PageNum(1).PageSize(100).
		Execute()

	s, _ := json.Marshal(resp)
	fmt.Println(string(s))

	if httpRes != nil {
		resBytes, _ := io.ReadAll(httpRes.Body)
		fmt.Println(string(resBytes))
	}
	fmt.Println(err)

}
